{
  //type 关键字用来声明类型的别名
  type n = number;
  type s = string;

  let num: n = 100;
  let str: s = '今天怎么阴天了~~';

  //type 定义接口
  type Person = {
    name: string;
    age: number;
    height: string;
  };

  let me: Person = {
    name: 'xiaohigh',
    age: 36,
    height: '180cm'
  };

  //声明一个变量
  let st: string = '哈哈哈';

  //typeof 获取某个变量的类型
  type res = typeof st;

  //获取接口所有键名的联合类型
  // keyof Person   getValue(me, 'abc')  key: 'name' | 'age' | 'height'
  function getValue(obj: Person, key: keyof Person){
    return obj[key];
  }

  getValue(me, 'age')

  //获取函数返回值类型
  let fn: (a: number, b: string) => string = (a, b) => a + b;

  type RetType = ReturnType<typeof fn>;

  //获取函数参数的类型
  type ParamType = Parameters<typeof fn>;

}

{
  axios.get('http://api.xiaohigh.com/heros');
}

{
  //内置对象的支持
  // let d = new Date();

  //支持 BOM 和 DOM
  // window.addEventListener('resize', () => {

  // });
  // document.querySelector('#root');
}

{
  //接口的叠加功能
  interface A{
    name: string;
  }

  interface A{
    color: string;
  }

  let a: A = {
    name: '英菲克',
    color: '浅黄色'
  }
}